<template>
    <el-tab-pane label="物料管理" name="material">
        <z-table title="物料管理" url="/do/join/material" :params="params" :columns="materialColumns"
                 :size="5">
            <template #header$="">
                <z-action label='添加物料' mode='dialog' :fields="materialFields" type='primary'
                          url='/do/put/con_material'/>
            </template>
            <template #action$="{ row }">
                <z-action label='删除' mode='confirm' link :data="row" url='/do/delete/con_material'/>
            </template>
        </z-table>
    </el-tab-pane>
</template>

<script>


export default {
    props: {
        params: Object,
    },
    data() {
        return {
            materialColumns: [
                {label: "物料名称", name: "title"},
                {label: "内部编码", name: "internalCode"},
                {label: "外部编码", name: "externalCode"},
                {label: "规格型号", name: "sku"},
                {label: "计量单位", name: "unit", code: "cfg_cfgMaterialUnit"},
                {label: "不含税金额", name: "taxExcluded", type: "money"},
                {label: "税率", name: "rate", code: "cfg_cfgRate"},
                {label: "含税金额", name: "gstInclusive", type: "money"},
                {label: "物料说明", name: "explain"}
            ],
            materialFields: [
                {label: "物料", name: "materialId", type: 'material', multiple: false, params: null},
                {label: "关联合同", name: "contractId", default: this.params.contractId, visible: false},
            ],
        }
    },
}
</script>
